import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Set;


public class Hash {

	
	public static void findReoccurrence(List<Integer> list){
		int key;
		Hashtable<Integer, Integer> hashTable = new Hashtable<Integer, Integer>();
		Iterator<Integer> itr = list.iterator();
		while(itr.hasNext()){
			key = itr.next();
			System.out.println(key);// for debugging
			if(!hashTable.containsKey(key)){
				hashTable.put(key,  1);
				System.out.println(hashTable.get(key));//for debugging
			}
			else{
				hashTable.put(key,  (hashTable.get(key)+1));
				System.out.println(hashTable.get(key));//for debugging
			}
		}
		
		Set<Integer> set = hashTable.keySet();
		Iterator<Integer> it = set.iterator();
		
		System.out.println(hashTable.toString());
		while(it.hasNext()){
			key = it.next();
			System.out.println(key + " has " + hashTable.get(key));
			
		}
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		
		List<Integer> list = new ArrayList<Integer>();
		list.add(3);
		list.add(4);
		list.add(3);
		list.add(6);
		list.add(3);
		list.add(6);
		list.add(3);
		findReoccurrence(list);
		
		
		
	}

}
